{extend name="public/common"}

{block name="style"}
<style>

    .navbar>.content-block>img{
        width:100%;height:50vw;
    }

    .list-block .item-content,.list-block .item-inner{
        padding:0;
    }
    .item-content{
        height:70px;
    }
    .item-content .item-inner>div:nth-child(1){
        position:relative;width:100%;border-bottom:1px solid #f1f1f1;padding:5px 12px;height:30px;
    }
    .item-content .item-inner>div:nth-child(1)>span:nth-child(1){
        color:#df4934;font-size:15px;font-weight: bold;
    }
    .item-content .item-inner>div:nth-child(1)>span:nth-child(2){
        position:absolute;right:12px;font-size:12px;color:#999;;
    }
    .item-content .item-inner>div:nth-child(1){
        width:100%;height:70px;border-bottom:1px solid #f1f1f1;padding:5px 12px;
    }
    .item-content .item-inner>div:nth-child(1)>div:nth-child(1){
        width:100%;font-size:14.5px;color:#333;height:40px;
    }
    .item-content .item-inner>div:nth-child(1)>div:nth-child(2){
        position:relative;width:100%;height:30px;
    }
    .item-content .item-inner>div:nth-child(1)>div:nth-child(2)>span,.item-content>.item-inner>div:nth-child(3)>div:nth-child(2)>span{
        font-size:15px;color:#999;
    }
    .item-content .item-inner>div:nth-child(1)>div:nth-child(2)>img,.item-content>.item-inner>div:nth-child(3)>div:nth-child(2)>img{
        width:12px;height:12px;position:absolute;top:3px;right:0;
    }
    .item-content .item-inner>div:nth-child(2){
        width:100%;height:70px;padding:0 12px;
    }
    .item-content .item-inner>div:nth-child(2)>div:nth-child(1){
        width:100%;font-size:14px;color:#333;height:40px;line-height:50px;
    }
    .item-content .item-inner>div:nth-child(2)>div:nth-child(2){
        position:relative;width:100%;height:30px;line-height:20px;
    }
    /*加载动画*/
    .tip {
        height: 40px;
        text-align: center;
        line-height: 40px;
        color: #c1c1c1;
    }
    .loading {
        width: 100%;
        height: 40px;
    }
    .typing_loader {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        -webkit-animation: typing 1s linear infinite alternate;
        -moz-animation: Typing 1s linear infinite alternate;
        animation: typing 1s linear infinite alternate;
        position: relative;
        top: 17px;
        left: calc( 50vw - 20px );
    }
    .limits{
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
    }
    .nomessage{
        text-align: center;
        position:fixed;
        top:42%;
        left:50%;
        -webkit-transform: translateY(-50%) translateX(-50%);
    }
    .nomessage>img{
        width:56%;
        margin-bottom:4vw;
    }
    .nomessage>span{
        font-size: 1.7rem;
        color:#ccc;
    }
</style>
{/block}

{block name="body"}
<div class="views">
    <!-- Your main view -->
    <div class="view view-main">
        <!-- Pages -->
        <!--<div class="title">政策解读</div>-->
        <div class="pages" >
            <div class="page" data-page="home">
                <div class="page-content">
                    <div class="list-block">
                        {empty name="list"}
                        <div class="nomessage">
                            <img src="__HOME__/images/sign/5.png" alt="" ><br>
                            <span>抱歉，暂无数据</span>
                        </div>
                        {else/}
                        <ul>
                            {volist name="list" id="vo"}
                            <li class="item-content" onclick=window.location.href="{:Url('Check/detail?id='.$vo['id'])}">
                                <div class="item-inner" >
                                    <div>
                                        <div class="limits">{$vo.title}</div>
                                        <div>
                                            <span>{$vo.nf} 年</span>
                                            <img src="__HOME__/images/right.png" alt="">
                                        </div>
                                    </div>
                                </div>
                            </li>
                            {/volist}
                        </ul>
                        {/empty}
                    </div>
                    <div class="tip"></div>
                    <div class="loading hidden">
                        <div class="typing_loader"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="script"}
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
    $('title' ).text('点对点教育VIP学员_私人定制');
    function onBridgeReady() {
        WeixinJSBridge.call('hideOptionMenu');
    }
    if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    } else {
        onBridgeReady();
    }
    $(function(){
        var b=$('.list-block>ul>li').length;
        if(b >= 15){
            $('.add1' ).text('上拉加载更多');
        }
        //上拉加载
        loadScroll();
    });
    function loadScroll(){
        $(window ).off("scroll" ).on("scroll",function(){
            var b=$('.list-block>ul>li').length;
            var type = "{$type}";
            var time = "{$time}";
            var school = "{$school}";
            var dh = $(document).height();
            var end = $(window).height() + $(window ).scrollTop();
            //var len = $(".list" ).length;
            var tip = $(".tip");
            var loading = $('.loading');
            if(dh == end){
                $.ajax({
                    type:"post",
                    url:"{:Url('Talent/listmore')}",
                    data:{
                        type:type,
                        time:time,
                        school:school,
                        length:b
                    },
                    beforeSend: function(XMLHttpRequest){
                        tip.hide();
                        loading.toggleClass('hidden');
                    },
                    success:function(data){
                        loading.toggleClass('hidden');
                        tip.show();
                        if(data.code == 1){
                            addMeets(data);
                            if(data.data.length == 15){
                                tip.text('上拉加载更多');
                            }
                        }else{
                            tip.text('没有更多了');
                            $(window ).off("scroll");
                        }
                    }
                })
            }
        })
    }
    function addMeets(data){
        var html = '';
        var lists = data.data;
        console.log(lists);
        var b = lists.length;
        for(var i=0; i< b;i++){
            var list = lists[i];
            html+='<li class="item-content">'+
                '<a href="/DDDeducation/public/index.php/home/Check/detail/id/'+list.id+'.html">'+
                '<div class="item-inner">'+
                '<div>'+
                '<div class="limits">'+list.title+'</div>'+
                '<div>'+
                '<span>'+list.nf+' 年</span>'+
                '<img src="__HOME__/images/right.png" alt="">'+
                '</div>'+
                '</div>'+
                '</div>'+
                '</a>'+
                '</li>';
        }
        $('.list-block ul').append(html);
    }

</script>
{/block}